package com.llb666.shop.items.api.vo;

import com.llb666.shop.items.domain.entity.Category;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import javax.persistence.Id;
import java.util.List;

/**
 * 商品一级分类vo.
 *
 * @author llb666
 * @version 1.0.0
 */
@Data
public class SimpleCategoryVo {
    /**
     * 主键
     */
    @Id
    private Integer id;

    /**
     * 分类名称
     */
    private String name;

    /**
     * 分类类型
     */
    private Integer type;

    /**
     * 父id
     */
    private Integer fatherId;

    /**
     * 图标
     */
    private String logo;

    /**
     * 口号
     */
    private String slogan;

    /**
     * 分类图
     */
    private String catImage;

    /**
     * 背景颜色
     */
    private String bgColor;


    @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    public interface Converter {
        SimpleCategoryVo.Converter INSTANCE = Mappers.getMapper(SimpleCategoryVo.Converter.class);

        SimpleCategoryVo do2Vo(Category category);

        List<SimpleCategoryVo> do2VoList(List<Category> categories);
    }
}
